/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mlbs.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author mckd87
 */
@Entity
@Table(name = "criteria")
@NamedQueries({@NamedQuery(name = "Criteria.findByCriteriaId", query = "SELECT c FROM Criteria c WHERE c.criteriaId = :criteriaId"), @NamedQuery(name = "Criteria.findByCategory", query = "SELECT c FROM Criteria c WHERE c.category = :category"), @NamedQuery(name = "Criteria.findByName", query = "SELECT c FROM Criteria c WHERE c.name = :name"), @NamedQuery(name = "Criteria.findByValue", query = "SELECT c FROM Criteria c WHERE c.value = :value")})
public class Criteria implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "criteriaId", nullable = false)
    private Integer criteriaId;
    @Column(name = "category")
    private String category;
    @Column(name = "name")
    private String name;
    @Column(name = "value")
    private String value;
    @OneToMany(mappedBy = "criteriaId")
    private Collection<Preferences> preferencesCollection;

    public Criteria() {
    }

    public Criteria(Integer criteriaId) {
        this.criteriaId = criteriaId;
    }

    public Integer getCriteriaId() {
        return criteriaId;
    }

    public void setCriteriaId(Integer criteriaId) {
        this.criteriaId = criteriaId;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Collection<Preferences> getPreferencesCollection() {
        return preferencesCollection;
    }

    public void setPreferencesCollection(Collection<Preferences> preferencesCollection) {
        this.preferencesCollection = preferencesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (criteriaId != null ? criteriaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Criteria)) {
            return false;
        }
        Criteria other = (Criteria) object;
        if ((this.criteriaId == null && other.criteriaId != null) || (this.criteriaId != null && !this.criteriaId.equals(other.criteriaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mlbs.entity.Criteria[criteriaId=" + criteriaId + "]";
    }

}
